// import config from '@';
import config from '../../config'
import axiosInstance from '../../utils/request'

const { API_URL_PREFIX_USER, API_URL_USER } = config

const api = {
  getGithubUser: (keyword: string) => {
    return axiosInstance({
        url: 'https://api.github.com' + '/search/users',
        // url: '/search/users',
        // url: config.API_URL_PREFIX_USER + '/search/users',
        method: 'get',
        params: {q: keyword}
    })
  },
  getToken: (data: any) => {
    return axiosInstance({
      url: `${API_URL_PREFIX_USER}/login/token`,
      method: 'post',
      data
    })
  },
  login: () => {
    return axiosInstance({
      url: `${API_URL_PREFIX_USER}/login/doLogin`,
      method: 'post'
    })
  },
  getMonthPageList: () => {
    // return axiosInstance({
    //     url: config.API_PROXY_STR + '/search/users',
    //     method: 'get',
    //     params: {}
    // })
    return Promise.resolve({
      code: 200,
      data: {
        total: 100,
        records: [
          {
            id: 1,
            title: '买避孕套',
            money: 100,
            type: '情趣',
            date: '2024-04-01',
            remark: '备注1'
          },
          {
            id: 2,
            title: '买黑丝袜',
            money: 2,
            type: '情趣',
            date: '2024-04-02',
            remark: '备注2'
          }
        ]
      }
    })
  },
}

export default api
